<?php
namespace App\Http\Controllers\Laifei\Explore;

use App\Http\Controllers\Controller;
use App\Models\Work;
use Illuminate\Support\Facades\Log;

class LaifeiExploreDetailController extends Controller
{

    public function index()
    {

        $all = $this->all;

        if(!isset($all['eo_id'])){
            return $this->setReturnJson(-1,'缺少参数');
        }
        $eo_id = $all['eo_id'];

        try{
            $order = Work::orderMessage($eo_id);
            $result = [
                'order' => $order,
                'works' => Work::orderWorks($eo_id),
                'shop' => Work::shopMessage($order['shop_id']),
                'log' => Work::orderLog($eo_id),
            ];
            return $this->setReturnJson(0, 'success', $result);
        }catch (\Exception $e){
            Log::error(LaifeiExploreDetailController::class,['msg' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
            return $this->setReturnJson(-1,'查询失败',['msg' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
        }

    }

}
